Integrand size = 21, antiderivative size = 106 \[ \int \frac {\cot ^2(c+d x)}{a+b \sec (c+d x)} \, dx=-\frac {x}{a}-\frac {2 b^3 \text {arctanh}\left (\frac {\sqrt {a^2-b^2} \tan \left (\frac {1}{2} (c+d x)\right )}{a+b}\right )}{a \left (a^2-b^2\right )^{3/2} d}-\frac {a \cot (c+d x)}{\left (a^2-b^2\right ) d}+\frac {b \csc (c+d x)}{\left (a^2-b^2\right ) d} \]
-x/a-2*b^3*arctanh((a^2-b^2)^(1/2)*tan(1/2*d*x+1/2*c)/(a+b))/a/(a^2-b^2)^( 3/2)/d-a*cot(d*x+c)/(a^2-b^2)/d+b*csc(d*x+c)/(a^2-b^2)/d
Time = 0.61 (sec) , antiderivative size = 147, normalized size of antiderivative = 1.39 \[ \int \frac {\cot ^2(c+d x)}{a+b \sec (c+d x)} \, dx=-\frac {\csc \left (\frac {1}{2} (c+d x)\right ) \sec \left (\frac {1}{2} (c+d x)\right ) \left (-2 b^3 \text {arctanh}\left (\frac {(-a+b) \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a^2-b^2}}\right ) \sin (c+d x)+\sqrt {a^2-b^2} \left (-a b+a^2 \cos (c+d x)+\left (a^2-b^2\right ) (c+d x) \sin (c+d x)\right )\right )}{2 a (a-b) (a+b) \sqrt {a^2-b^2} d} \]
-1/2*(Csc[(c + d*x)/2]*Sec[(c + d*x)/2]*(-2*b^3*ArcTanh[((-a + b)*Tan[(c + d*x)/2])/Sqrt[a^2 - b^2]]*Sin[c + d*x] + Sqrt[a^2 - b^2]*(-(a*b) + a^2*Co s[c + d*x] + (a^2 - b^2)*(c + d*x)*Sin[c + d*x])))/(a*(a - b)*(a + b)*Sqrt [a^2 - b^2]*d)
Time = 0.74 (sec) , antiderivative size = 125, normalized size of antiderivative = 1.18, number of steps used = 17, number of rules used = 16, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.762, Rules used = {3042, 4386, 3042, 25, 3381, 25, 3042, 25, 3086, 24, 3214, 3042, 3138, 221, 3954, 24}
Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.
\(\displaystyle \int \frac {\cot ^2(c+d x)}{a+b \sec (c+d x)} \, dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int \frac {1}{\cot \left (c+d x+\frac {\pi }{2}\right )^2 \left (a+b \csc \left (c+d x+\frac {\pi }{2}\right )\right )}dx\) |
\(\Big \downarrow \) 4386 |
\(\displaystyle \int \frac {\cos (c+d x) \cot ^2(c+d x)}{a \cos (c+d x)+b}dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int -\frac {\sin \left (c+d x-\frac {\pi }{2}\right )^3}{\cos \left (c+d x-\frac {\pi }{2}\right )^2 \left (b-a \sin \left (c+d x-\frac {\pi }{2}\right )\right )}dx\) |
\(\Big \downarrow \) 25 |
\(\displaystyle -\int \frac {\sin \left (\frac {1}{2} (2 c-\pi )+d x\right )^3}{\cos \left (\frac {1}{2} (2 c-\pi )+d x\right )^2 \left (b-a \sin \left (\frac {1}{2} (2 c-\pi )+d x\right )\right )}dx\) |
\(\Big \downarrow \) 3381 |
\(\displaystyle -\frac {b^2 \int -\frac {\cos (c+d x)}{b+a \cos (c+d x)}dx}{a^2-b^2}+\frac {a \int \cot ^2(c+d x)dx}{a^2-b^2}+\frac {b \int -\cot (c+d x) \csc (c+d x)dx}{a^2-b^2}\) |
\(\Big \downarrow \) 25 |
\(\displaystyle \frac {b^2 \int \frac {\cos (c+d x)}{b+a \cos (c+d x)}dx}{a^2-b^2}+\frac {a \int \cot ^2(c+d x)dx}{a^2-b^2}-\frac {b \int \cot (c+d x) \csc (c+d x)dx}{a^2-b^2}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \frac {b^2 \int \frac {\sin \left (c+d x+\frac {\pi }{2}\right )}{b+a \sin \left (c+d x+\frac {\pi }{2}\right )}dx}{a^2-b^2}+\frac {a \int \tan \left (c+d x+\frac {\pi }{2}\right )^2dx}{a^2-b^2}-\frac {b \int -\sec \left (c+d x-\frac {\pi }{2}\right ) \tan \left (c+d x-\frac {\pi }{2}\right )dx}{a^2-b^2}\) |
\(\Big \downarrow \) 25 |
\(\displaystyle \frac {b^2 \int \frac {\sin \left (c+d x+\frac {\pi }{2}\right )}{b+a \sin \left (c+d x+\frac {\pi }{2}\right )}dx}{a^2-b^2}+\frac {a \int \tan \left (c+d x+\frac {\pi }{2}\right )^2dx}{a^2-b^2}+\frac {b \int \sec \left (\frac {1}{2} (2 c-\pi )+d x\right ) \tan \left (\frac {1}{2} (2 c-\pi )+d x\right )dx}{a^2-b^2}\) |
\(\Big \downarrow \) 3086 |
\(\displaystyle \frac {b^2 \int \frac {\sin \left (c+d x+\frac {\pi }{2}\right )}{b+a \sin \left (c+d x+\frac {\pi }{2}\right )}dx}{a^2-b^2}+\frac {a \int \tan \left (c+d x+\frac {\pi }{2}\right )^2dx}{a^2-b^2}+\frac {b \int 1d\csc (c+d x)}{d \left (a^2-b^2\right )}\) |
\(\Big \downarrow \) 24 |
\(\displaystyle \frac {b^2 \int \frac {\sin \left (c+d x+\frac {\pi }{2}\right )}{b+a \sin \left (c+d x+\frac {\pi }{2}\right )}dx}{a^2-b^2}+\frac {a \int \tan \left (c+d x+\frac {\pi }{2}\right )^2dx}{a^2-b^2}+\frac {b \csc (c+d x)}{d \left (a^2-b^2\right )}\) |
\(\Big \downarrow \) 3214 |
\(\displaystyle \frac {b^2 \left (\frac {x}{a}-\frac {b \int \frac {1}{b+a \cos (c+d x)}dx}{a}\right )}{a^2-b^2}+\frac {a \int \tan \left (c+d x+\frac {\pi }{2}\right )^2dx}{a^2-b^2}+\frac {b \csc (c+d x)}{d \left (a^2-b^2\right )}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \frac {b^2 \left (\frac {x}{a}-\frac {b \int \frac {1}{b+a \sin \left (c+d x+\frac {\pi }{2}\right )}dx}{a}\right )}{a^2-b^2}+\frac {a \int \tan \left (c+d x+\frac {\pi }{2}\right )^2dx}{a^2-b^2}+\frac {b \csc (c+d x)}{d \left (a^2-b^2\right )}\) |
\(\Big \downarrow \) 3138 |
\(\displaystyle \frac {b^2 \left (\frac {x}{a}-\frac {2 b \int \frac {1}{-\left ((a-b) \tan ^2\left (\frac {1}{2} (c+d x)\right )\right )+a+b}d\tan \left (\frac {1}{2} (c+d x)\right )}{a d}\right )}{a^2-b^2}+\frac {a \int \tan \left (c+d x+\frac {\pi }{2}\right )^2dx}{a^2-b^2}+\frac {b \csc (c+d x)}{d \left (a^2-b^2\right )}\) |
\(\Big \downarrow \) 221 |
\(\displaystyle \frac {a \int \tan \left (c+d x+\frac {\pi }{2}\right )^2dx}{a^2-b^2}+\frac {b^2 \left (\frac {x}{a}-\frac {2 b \text {arctanh}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{a d \sqrt {a-b} \sqrt {a+b}}\right )}{a^2-b^2}+\frac {b \csc (c+d x)}{d \left (a^2-b^2\right )}\) |
\(\Big \downarrow \) 3954 |
\(\displaystyle \frac {a \left (-\int 1dx-\frac {\cot (c+d x)}{d}\right )}{a^2-b^2}+\frac {b^2 \left (\frac {x}{a}-\frac {2 b \text {arctanh}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{a d \sqrt {a-b} \sqrt {a+b}}\right )}{a^2-b^2}+\frac {b \csc (c+d x)}{d \left (a^2-b^2\right )}\) |
\(\Big \downarrow \) 24 |
\(\displaystyle \frac {b^2 \left (\frac {x}{a}-\frac {2 b \text {arctanh}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{a d \sqrt {a-b} \sqrt {a+b}}\right )}{a^2-b^2}+\frac {a \left (-\frac {\cot (c+d x)}{d}-x\right )}{a^2-b^2}+\frac {b \csc (c+d x)}{d \left (a^2-b^2\right )}\) |
(b^2*(x/a - (2*b*ArcTanh[(Sqrt[a - b]*Tan[(c + d*x)/2])/Sqrt[a + b]])/(a*S qrt[a - b]*Sqrt[a + b]*d)))/(a^2 - b^2) + (a*(-x - Cot[c + d*x]/d))/(a^2 - b^2) + (b*Csc[c + d*x])/((a^2 - b^2)*d)
3.3.97.3.1 Defintions of rubi rules used
Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(Rt[-a/b, 2]/a)*ArcTanh[x /Rt[-a/b, 2]], x] /; FreeQ[{a, b}, x] && NegQ[a/b]
Int[((a_.)*sec[(e_.) + (f_.)*(x_)])^(m_.)*((b_.)*tan[(e_.) + (f_.)*(x_)])^( n_.), x_Symbol] :> Simp[a/f Subst[Int[(a*x)^(m - 1)*(-1 + x^2)^((n - 1)/2 ), x], x, Sec[e + f*x]], x] /; FreeQ[{a, e, f, m}, x] && IntegerQ[(n - 1)/2 ] && !(IntegerQ[m/2] && LtQ[0, m, n + 1])
Int[((a_) + (b_.)*sin[Pi/2 + (c_.) + (d_.)*(x_)])^(-1), x_Symbol] :> With[{ e = FreeFactors[Tan[(c + d*x)/2], x]}, Simp[2*(e/d) Subst[Int[1/(a + b + (a - b)*e^2*x^2), x], x, Tan[(c + d*x)/2]/e], x]] /; FreeQ[{a, b, c, d}, x] && NeQ[a^2 - b^2, 0]
Int[((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])/((c_.) + (d_.)*sin[(e_.) + (f_. )*(x_)]), x_Symbol] :> Simp[b*(x/d), x] - Simp[(b*c - a*d)/d Int[1/(c + d *Sin[e + f*x]), x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0]
Int[((cos[(e_.) + (f_.)*(x_)]*(g_.))^(p_)*((d_.)*sin[(e_.) + (f_.)*(x_)])^( n_))/((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[a*(d^2/(a^2 - b^2)) Int[(g*Cos[e + f*x])^p*(d*Sin[e + f*x])^(n - 2), x], x] + (-Simp[ b*(d/(a^2 - b^2)) Int[(g*Cos[e + f*x])^p*(d*Sin[e + f*x])^(n - 1), x], x] - Simp[a^2*(d^2/(g^2*(a^2 - b^2))) Int[(g*Cos[e + f*x])^(p + 2)*((d*Sin[ e + f*x])^(n - 2)/(a + b*Sin[e + f*x])), x], x]) /; FreeQ[{a, b, d, e, f, g }, x] && NeQ[a^2 - b^2, 0] && IntegersQ[2*n, 2*p] && LtQ[p, -1] && GtQ[n, 1 ]
Int[((b_.)*tan[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[b*((b*Tan[c + d *x])^(n - 1)/(d*(n - 1))), x] - Simp[b^2 Int[(b*Tan[c + d*x])^(n - 2), x] , x] /; FreeQ[{b, c, d}, x] && GtQ[n, 1]
Int[cot[(c_.) + (d_.)*(x_)]^(m_.)*(csc[(c_.) + (d_.)*(x_)]*(b_.) + (a_))^(n _), x_Symbol] :> Int[Cos[c + d*x]^m*((b + a*Sin[c + d*x])^n/Sin[c + d*x]^(m + n)), x] /; FreeQ[{a, b, c, d}, x] && NeQ[a^2 - b^2, 0] && IntegerQ[n] && IntegerQ[m] && (IntegerQ[m/2] || LeQ[m, 1])
Time = 0.76 (sec) , antiderivative size = 115, normalized size of antiderivative = 1.08
method | result | size |
derivativedivides | \(\frac {\frac {\tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{2 a -2 b}-\frac {2 \arctan \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{a}-\frac {2 b^{3} \operatorname {arctanh}\left (\frac {\left (a -b \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{\sqrt {\left (a -b \right ) \left (a +b \right )}}\right )}{\left (a -b \right ) \left (a +b \right ) a \sqrt {\left (a -b \right ) \left (a +b \right )}}-\frac {1}{2 \left (a +b \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}}{d}\) | \(115\) |
default | \(\frac {\frac {\tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{2 a -2 b}-\frac {2 \arctan \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{a}-\frac {2 b^{3} \operatorname {arctanh}\left (\frac {\left (a -b \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{\sqrt {\left (a -b \right ) \left (a +b \right )}}\right )}{\left (a -b \right ) \left (a +b \right ) a \sqrt {\left (a -b \right ) \left (a +b \right )}}-\frac {1}{2 \left (a +b \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}}{d}\) | \(115\) |
risch | \(-\frac {x}{a}-\frac {2 i \left (-b \,{\mathrm e}^{i \left (d x +c \right )}+a \right )}{d \left (a^{2}-b^{2}\right ) \left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right )}-\frac {b^{3} \ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {i a^{2}-i b^{2}+b \sqrt {a^{2}-b^{2}}}{\sqrt {a^{2}-b^{2}}\, a}\right )}{\sqrt {a^{2}-b^{2}}\, \left (a +b \right ) \left (a -b \right ) d a}+\frac {b^{3} \ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {-i a^{2}+i b^{2}+b \sqrt {a^{2}-b^{2}}}{a \sqrt {a^{2}-b^{2}}}\right )}{\sqrt {a^{2}-b^{2}}\, \left (a +b \right ) \left (a -b \right ) d a}\) | \(223\) |
1/d*(1/2*tan(1/2*d*x+1/2*c)/(a-b)-2/a*arctan(tan(1/2*d*x+1/2*c))-2/(a-b)/( a+b)*b^3/a/((a-b)*(a+b))^(1/2)*arctanh((a-b)*tan(1/2*d*x+1/2*c)/((a-b)*(a+ b))^(1/2))-1/2/(a+b)/tan(1/2*d*x+1/2*c))
Time = 0.30 (sec) , antiderivative size = 362, normalized size of antiderivative = 3.42 \[ \int \frac {\cot ^2(c+d x)}{a+b \sec (c+d x)} \, dx=\left [-\frac {\sqrt {a^{2} - b^{2}} b^{3} \log \left (\frac {2 \, a b \cos \left (d x + c\right ) - {\left (a^{2} - 2 \, b^{2}\right )} \cos \left (d x + c\right )^{2} + 2 \, \sqrt {a^{2} - b^{2}} {\left (b \cos \left (d x + c\right ) + a\right )} \sin \left (d x + c\right ) + 2 \, a^{2} - b^{2}}{a^{2} \cos \left (d x + c\right )^{2} + 2 \, a b \cos \left (d x + c\right ) + b^{2}}\right ) \sin \left (d x + c\right ) - 2 \, a^{3} b + 2 \, a b^{3} + 2 \, {\left (a^{4} - 2 \, a^{2} b^{2} + b^{4}\right )} d x \sin \left (d x + c\right ) + 2 \, {\left (a^{4} - a^{2} b^{2}\right )} \cos \left (d x + c\right )}{2 \, {\left (a^{5} - 2 \, a^{3} b^{2} + a b^{4}\right )} d \sin \left (d x + c\right )}, -\frac {\sqrt {-a^{2} + b^{2}} b^{3} \arctan \left (-\frac {\sqrt {-a^{2} + b^{2}} {\left (b \cos \left (d x + c\right ) + a\right )}}{{\left (a^{2} - b^{2}\right )} \sin \left (d x + c\right )}\right ) \sin \left (d x + c\right ) - a^{3} b + a b^{3} + {\left (a^{4} - 2 \, a^{2} b^{2} + b^{4}\right )} d x \sin \left (d x + c\right ) + {\left (a^{4} - a^{2} b^{2}\right )} \cos \left (d x + c\right )}{{\left (a^{5} - 2 \, a^{3} b^{2} + a b^{4}\right )} d \sin \left (d x + c\right )}\right ] \]
[-1/2*(sqrt(a^2 - b^2)*b^3*log((2*a*b*cos(d*x + c) - (a^2 - 2*b^2)*cos(d*x + c)^2 + 2*sqrt(a^2 - b^2)*(b*cos(d*x + c) + a)*sin(d*x + c) + 2*a^2 - b^ 2)/(a^2*cos(d*x + c)^2 + 2*a*b*cos(d*x + c) + b^2))*sin(d*x + c) - 2*a^3*b + 2*a*b^3 + 2*(a^4 - 2*a^2*b^2 + b^4)*d*x*sin(d*x + c) + 2*(a^4 - a^2*b^2 )*cos(d*x + c))/((a^5 - 2*a^3*b^2 + a*b^4)*d*sin(d*x + c)), -(sqrt(-a^2 + b^2)*b^3*arctan(-sqrt(-a^2 + b^2)*(b*cos(d*x + c) + a)/((a^2 - b^2)*sin(d* x + c)))*sin(d*x + c) - a^3*b + a*b^3 + (a^4 - 2*a^2*b^2 + b^4)*d*x*sin(d* x + c) + (a^4 - a^2*b^2)*cos(d*x + c))/((a^5 - 2*a^3*b^2 + a*b^4)*d*sin(d* x + c))]
\[ \int \frac {\cot ^2(c+d x)}{a+b \sec (c+d x)} \, dx=\int \frac {\cot ^{2}{\left (c + d x \right )}}{a + b \sec {\left (c + d x \right )}}\, dx \]
Exception generated. \[ \int \frac {\cot ^2(c+d x)}{a+b \sec (c+d x)} \, dx=\text {Exception raised: ValueError} \]
Exception raised: ValueError >> Computation failed since Maxima requested additional constraints; using the 'assume' command before evaluation *may* help (example of legal syntax is 'assume(4*a^2-4*b^2>0)', see `assume?` f or more de
Leaf count of result is larger than twice the leaf count of optimal. 582 vs. \(2 (101) = 202\).
Time = 0.38 (sec) , antiderivative size = 582, normalized size of antiderivative = 5.49 \[ \int \frac {\cot ^2(c+d x)}{a+b \sec (c+d x)} \, dx=-\frac {\frac {2 \, {\left (a^{5} - a^{4} b - 2 \, a^{3} b^{2} + 3 \, a^{2} b^{3} + a b^{4} - 2 \, b^{5} - a^{2} {\left | -a^{3} + a b^{2} \right |} + a b {\left | -a^{3} + a b^{2} \right |} + b^{2} {\left | -a^{3} + a b^{2} \right |}\right )} {\left (\pi \left \lfloor \frac {d x + c}{2 \, \pi } + \frac {1}{2} \right \rfloor + \arctan \left (\frac {\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{\sqrt {-\frac {a^{2} b - b^{3} + \sqrt {{\left (a^{3} + a^{2} b - a b^{2} - b^{3}\right )} {\left (a^{3} - a^{2} b - a b^{2} + b^{3}\right )} + {\left (a^{2} b - b^{3}\right )}^{2}}}{a^{3} - a^{2} b - a b^{2} + b^{3}}}}\right )\right )}}{a^{2} b {\left | -a^{3} + a b^{2} \right |} - b^{3} {\left | -a^{3} + a b^{2} \right |} + {\left (a^{3} - a b^{2}\right )}^{2}} + \frac {2 \, {\left ({\left (a^{2} - a b - b^{2}\right )} \sqrt {-a^{2} + b^{2}} {\left | -a^{3} + a b^{2} \right |} {\left | -a + b \right |} + {\left (a^{5} - a^{4} b - 2 \, a^{3} b^{2} + 3 \, a^{2} b^{3} + a b^{4} - 2 \, b^{5}\right )} \sqrt {-a^{2} + b^{2}} {\left | -a + b \right |}\right )} {\left (\pi \left \lfloor \frac {d x + c}{2 \, \pi } + \frac {1}{2} \right \rfloor + \arctan \left (\frac {\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{\sqrt {-\frac {a^{2} b - b^{3} - \sqrt {{\left (a^{3} + a^{2} b - a b^{2} - b^{3}\right )} {\left (a^{3} - a^{2} b - a b^{2} + b^{3}\right )} + {\left (a^{2} b - b^{3}\right )}^{2}}}{a^{3} - a^{2} b - a b^{2} + b^{3}}}}\right )\right )}}{{\left (a^{3} - a b^{2}\right )}^{2} {\left (a^{2} - 2 \, a b + b^{2}\right )} - {\left (a^{4} b - 2 \, a^{3} b^{2} + 2 \, a b^{4} - b^{5}\right )} {\left | -a^{3} + a b^{2} \right |}} - \frac {\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{a - b} + \frac {1}{{\left (a + b\right )} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}}{2 \, d} \]
-1/2*(2*(a^5 - a^4*b - 2*a^3*b^2 + 3*a^2*b^3 + a*b^4 - 2*b^5 - a^2*abs(-a^ 3 + a*b^2) + a*b*abs(-a^3 + a*b^2) + b^2*abs(-a^3 + a*b^2))*(pi*floor(1/2* (d*x + c)/pi + 1/2) + arctan(tan(1/2*d*x + 1/2*c)/sqrt(-(a^2*b - b^3 + sqr t((a^3 + a^2*b - a*b^2 - b^3)*(a^3 - a^2*b - a*b^2 + b^3) + (a^2*b - b^3)^ 2))/(a^3 - a^2*b - a*b^2 + b^3))))/(a^2*b*abs(-a^3 + a*b^2) - b^3*abs(-a^3 + a*b^2) + (a^3 - a*b^2)^2) + 2*((a^2 - a*b - b^2)*sqrt(-a^2 + b^2)*abs(- a^3 + a*b^2)*abs(-a + b) + (a^5 - a^4*b - 2*a^3*b^2 + 3*a^2*b^3 + a*b^4 - 2*b^5)*sqrt(-a^2 + b^2)*abs(-a + b))*(pi*floor(1/2*(d*x + c)/pi + 1/2) + a rctan(tan(1/2*d*x + 1/2*c)/sqrt(-(a^2*b - b^3 - sqrt((a^3 + a^2*b - a*b^2 - b^3)*(a^3 - a^2*b - a*b^2 + b^3) + (a^2*b - b^3)^2))/(a^3 - a^2*b - a*b^ 2 + b^3))))/((a^3 - a*b^2)^2*(a^2 - 2*a*b + b^2) - (a^4*b - 2*a^3*b^2 + 2* a*b^4 - b^5)*abs(-a^3 + a*b^2)) - tan(1/2*d*x + 1/2*c)/(a - b) + 1/((a + b )*tan(1/2*d*x + 1/2*c)))/d
Time = 16.55 (sec) , antiderivative size = 1002, normalized size of antiderivative = 9.45 \[ \int \frac {\cot ^2(c+d x)}{a+b \sec (c+d x)} \, dx=-\frac {1{}\mathrm {i}\,\cos \left (c+d\,x\right )\,a^6-a^5\,b\,1{}\mathrm {i}-2{}\mathrm {i}\,\cos \left (c+d\,x\right )\,a^4\,b^2+a^3\,b^3\,2{}\mathrm {i}+1{}\mathrm {i}\,\cos \left (c+d\,x\right )\,a^2\,b^4-a\,b^5\,1{}\mathrm {i}}{1{}\mathrm {i}\,d\,\sin \left (c+d\,x\right )\,a^7-3{}\mathrm {i}\,d\,\sin \left (c+d\,x\right )\,a^5\,b^2+3{}\mathrm {i}\,d\,\sin \left (c+d\,x\right )\,a^3\,b^4-1{}\mathrm {i}\,d\,\sin \left (c+d\,x\right )\,a\,b^6}+\frac {-a^6\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,2{}\mathrm {i}+b^6\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,2{}\mathrm {i}-a^2\,b^4\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,6{}\mathrm {i}+a^4\,b^2\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,6{}\mathrm {i}+b^3\,\mathrm {atanh}\left (\frac {2\,b^7\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,{\left (a^6-3\,a^4\,b^2+3\,a^2\,b^4-b^6\right )}^{3/2}-a^{13}\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\sqrt {a^6-3\,a^4\,b^2+3\,a^2\,b^4-b^6}+2\,b^{13}\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\sqrt {a^6-3\,a^4\,b^2+3\,a^2\,b^4-b^6}-9\,a^2\,b^{11}\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\sqrt {a^6-3\,a^4\,b^2+3\,a^2\,b^4-b^6}+3\,a^3\,b^{10}\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\sqrt {a^6-3\,a^4\,b^2+3\,a^2\,b^4-b^6}+18\,a^4\,b^9\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\sqrt {a^6-3\,a^4\,b^2+3\,a^2\,b^4-b^6}-12\,a^5\,b^8\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\sqrt {a^6-3\,a^4\,b^2+3\,a^2\,b^4-b^6}-21\,a^6\,b^7\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\sqrt {a^6-3\,a^4\,b^2+3\,a^2\,b^4-b^6}+19\,a^7\,b^6\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\sqrt {a^6-3\,a^4\,b^2+3\,a^2\,b^4-b^6}+15\,a^8\,b^5\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\sqrt {a^6-3\,a^4\,b^2+3\,a^2\,b^4-b^6}-15\,a^9\,b^4\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\sqrt {a^6-3\,a^4\,b^2+3\,a^2\,b^4-b^6}-6\,a^{10}\,b^3\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\sqrt {a^6-3\,a^4\,b^2+3\,a^2\,b^4-b^6}+6\,a^{11}\,b^2\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\sqrt {a^6-3\,a^4\,b^2+3\,a^2\,b^4-b^6}+a^{12}\,b\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\sqrt {a^6-3\,a^4\,b^2+3\,a^2\,b^4-b^6}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\left (a^{16}-8\,a^{14}\,b^2+28\,a^{12}\,b^4-55\,a^{10}\,b^6+65\,a^8\,b^8-46\,a^6\,b^{10}+18\,a^4\,b^{12}-3\,a^2\,b^{14}\right )}\right )\,\sqrt {a^6-3\,a^4\,b^2+3\,a^2\,b^4-b^6}\,2{}\mathrm {i}}{1{}\mathrm {i}\,d\,a^7-3{}\mathrm {i}\,d\,a^5\,b^2+3{}\mathrm {i}\,d\,a^3\,b^4-1{}\mathrm {i}\,d\,a\,b^6} \]
(b^6*atan(sin(c/2 + (d*x)/2)/cos(c/2 + (d*x)/2))*2i - a^6*atan(sin(c/2 + ( d*x)/2)/cos(c/2 + (d*x)/2))*2i - a^2*b^4*atan(sin(c/2 + (d*x)/2)/cos(c/2 + (d*x)/2))*6i + a^4*b^2*atan(sin(c/2 + (d*x)/2)/cos(c/2 + (d*x)/2))*6i + b ^3*atanh((2*b^7*sin(c/2 + (d*x)/2)*(a^6 - b^6 + 3*a^2*b^4 - 3*a^4*b^2)^(3/ 2) - a^13*sin(c/2 + (d*x)/2)*(a^6 - b^6 + 3*a^2*b^4 - 3*a^4*b^2)^(1/2) + 2 *b^13*sin(c/2 + (d*x)/2)*(a^6 - b^6 + 3*a^2*b^4 - 3*a^4*b^2)^(1/2) - 9*a^2 *b^11*sin(c/2 + (d*x)/2)*(a^6 - b^6 + 3*a^2*b^4 - 3*a^4*b^2)^(1/2) + 3*a^3 *b^10*sin(c/2 + (d*x)/2)*(a^6 - b^6 + 3*a^2*b^4 - 3*a^4*b^2)^(1/2) + 18*a^ 4*b^9*sin(c/2 + (d*x)/2)*(a^6 - b^6 + 3*a^2*b^4 - 3*a^4*b^2)^(1/2) - 12*a^ 5*b^8*sin(c/2 + (d*x)/2)*(a^6 - b^6 + 3*a^2*b^4 - 3*a^4*b^2)^(1/2) - 21*a^ 6*b^7*sin(c/2 + (d*x)/2)*(a^6 - b^6 + 3*a^2*b^4 - 3*a^4*b^2)^(1/2) + 19*a^ 7*b^6*sin(c/2 + (d*x)/2)*(a^6 - b^6 + 3*a^2*b^4 - 3*a^4*b^2)^(1/2) + 15*a^ 8*b^5*sin(c/2 + (d*x)/2)*(a^6 - b^6 + 3*a^2*b^4 - 3*a^4*b^2)^(1/2) - 15*a^ 9*b^4*sin(c/2 + (d*x)/2)*(a^6 - b^6 + 3*a^2*b^4 - 3*a^4*b^2)^(1/2) - 6*a^1 0*b^3*sin(c/2 + (d*x)/2)*(a^6 - b^6 + 3*a^2*b^4 - 3*a^4*b^2)^(1/2) + 6*a^1 1*b^2*sin(c/2 + (d*x)/2)*(a^6 - b^6 + 3*a^2*b^4 - 3*a^4*b^2)^(1/2) + a^12* b*sin(c/2 + (d*x)/2)*(a^6 - b^6 + 3*a^2*b^4 - 3*a^4*b^2)^(1/2))/(cos(c/2 + (d*x)/2)*(a^16 - 3*a^2*b^14 + 18*a^4*b^12 - 46*a^6*b^10 + 65*a^8*b^8 - 55 *a^10*b^6 + 28*a^12*b^4 - 8*a^14*b^2)))*(a^6 - b^6 + 3*a^2*b^4 - 3*a^4*b^2 )^(1/2)*2i)/(a^7*d*1i + a^3*b^4*d*3i - a^5*b^2*d*3i - a*b^6*d*1i) - (a^...